package com.lemon.components.ant.project.beans;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.lemon.components.ant.beans.ProjectInfo;
import com.system.core.security.NameUtil;

public class ServiceInfo extends BaseInfo{
	
	private String serviceName;
	private String serviceOpt;
	private String serviceClazz;
	private String modelClazz;
	private String mapperClazz;
	private String modelName;
	private ProjectInfo projectInfo;
	private String serviceClazzPath;
	private String servicesrcPath;
	private TableInfo tableInfo;
	private List<ColumnInfo> columns;
	private ColumnInfo keyColumn;
	
	public ColumnInfo getKeyColumn() {
		return keyColumn;
	}

	public void setKeyColumn(ColumnInfo keyColumn) {
		this.keyColumn = keyColumn;
	}

	private String enumName;
	private List<String> enumValues;
	
	public String getModelClazz() {
		this.modelClazz = "com."+projectInfo.getCompanyName()+"."+projectInfo.getArtifactId()+".dal.mybatis.model."+getModelName();
		return modelClazz;
	}

	public void setModelClazz(String modelClazz) {
		this.modelClazz = modelClazz;
	}

	public String getModelName() {
		return StringUtils.capitalize(modelName);
	}

	public void setModelName(String modelName) {
		this.modelName = modelName;
	}
	
	public String getServiceClazzPath() {
		this.serviceClazzPath = "/"+getServiceClazz().replaceAll("\\.", "/").toLowerCase();
		return serviceClazzPath;
	}

	public String getServiceClazz() {
		this.serviceClazz = "com."+projectInfo.getCompanyName()+"."+projectInfo.getArtifactId()+".service."+StringUtils.uncapitalize(getServiceName());
		return serviceClazz;
	}


	public String getServiceName() {
		if(StringUtils.isNotBlank(serviceName))
			return serviceName;
		else
			return NameUtil.instanceName(getModelName());
	}

	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	public ProjectInfo getProjectInfo() {
		return projectInfo;
	}

	public void setProjectInfo(ProjectInfo projectInfo) {
		this.projectInfo = projectInfo;
	}

	public String getServicesrcPath() {
		this.servicesrcPath = projectInfo.getProjectPath()+"/"+projectInfo.getArtifactId()+"/"+projectInfo.getArtifactId()+"-biz/src/main/java";
		return servicesrcPath;
	}

	public String getMapperClazz() {
		this.mapperClazz = "com."+projectInfo.getCompanyName()+"."+projectInfo.getArtifactId()+".dal.mybatis.mapper."+getModelName()+"Mapper";
		return mapperClazz;
	}

	public void setMapperClazz(String mapperClazz) {
		this.mapperClazz = mapperClazz;
	}

	public List<ColumnInfo> getColumns() {
		return columns;
	}

	public void setColumns(List<ColumnInfo> columns) {
		this.columns = columns;
	}

	@Override
	public String getTIMESTARTSTR() {
		return super.getTIMESTARTSTR();
	}

	@Override
	public String getTIMEENDSTR() {
		return super.getTIMEENDSTR();
	}

	public String getEnumName() {
		return enumName;
	}

	public void setEnumName(String enumName) {
		this.enumName = enumName;
	}

	public List<String> getEnumValues() {
		return enumValues;
	}

	public void setEnumValues(List<String> enumValues) {
		this.enumValues = enumValues;
	}

	public String getServiceOpt() {
		return serviceOpt;
	}

	public void setServiceOpt(String serviceOpt) {
		this.serviceOpt = serviceOpt;
	}

	public TableInfo getTableInfo() {
		return tableInfo;
	}

	public void setTableInfo(TableInfo tableInfo) {
		this.tableInfo = tableInfo;
	}


}
